<#include
        "/common/coms.html"  /> <@layout>
<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />
<script src="${ctx}/static/inc/platform/js/ajax.js"></script>
<script type="text/javascript">
    function changesx(){
        $("#txt1").attr("class","txt1_class2");
    }
    /**
     * addnew model
     */
    function saveModel() {
        if(Validator.Validate(document.getElementById('form1'))){
        } else {
            return;
        }
        var id=document.getElementById("id").value;
        var url = '';
        if(id==""){
            url = '${ctx}/wxMessage/save';
        }     else{
            url = '${ctx}/wxMessage/update';
        }
        $('#form1').form('submit', {
            url : url,
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(data) {
                alert(data);
                parent.location.reload();
            }
        });

    }
</script>
    <body class="easyui-layout">
    <div class="page-header" style="height: 20px">
        <div class="row-fluid">
            <div class="span12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="tabbable tabs-left">
                    <form class="form-horizontal"  id="form1" method="post" >
                        <input type="hidden"  name="wxMessage.id" id="id"    >

                        <table class="table table-condensed table-bordered">
                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">标题:</td>
                                <td style=""> <input id="title"   style="min-height: 24px;"  maxlength="10"
                                                     name="wxMessage.title" type="text"   dataType="Require" msg="请输入标题"/>
                                </td>
                            </tr>
                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">消息类型:</td>
                                <td style="">
                                  <select name="wxMessage.msgtype" id="msgtype" require="true"  dataType="Require" msg="请选择消息类型" style="width: 200px"  >
                                      <option value="" selected>请选择</option>
                                      <#list types as s>
                                            <option value="${(s.msgtype)!}">${(s.textname)!}</option>
                                        </#list>
                                    </select>

                                </td>
                            </tr>
                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">关键字描述:</td>
                                <td style=""> <input id="description" style="min-height: 24px;"
                                                     name="wxMessage.description" type="text" dataType="Require" msg="请输入关键字"/>
                                </td>
                            </tr>
                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">文本内容:</td>
                                <td style="">
                                    <!--<input id="content"  style="min-height: 24px;"-->
                                    <!--name="content" type="text" require="false"  dataType="Require" msg="请输入文本内容" dataType="Require" msg="请输入标题"/>-->
                                    <textarea class="span12"  id="content" name="wxMessage.content" rows="5" maxlength="725"><#list newlist as m>${(m.content)!}</#list></textarea>
                                </td>
                            </tr>

                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">链接:</td>
                                <td style=""> <input id="url"  style="min-height: 24px;"    placeholder="http://xxxx"
                                                     name="wxMessage.url" type="text" require="false"  dataType="Url" msg="请输入url"/>
                                </td>
                            </tr>

                            <tr class="info">

                                <td style="text-align: left;white-space:nowrap;">高质量连接:</td>
                                <td style=""> <input id="hqurl"  style="min-height: 24px;"
                                    name="wxMessage.hqurl" type="text"  />
                                </td>
                            </tr>

                            <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">图片链接:</td>
                                <td style=""> <input id="picurl"  style="min-height: 24px;"
                                    name="wxMessage.picurl" type="text"  />
                                </td>
                                      <tr class="info">
                                <td style="text-align: left;white-space:nowrap;">关注时推送此事件:</td>
                                <td style="">
                                    <select id="yxbz" name="yxbz">
                                       <option value="0" selected>否</option>
                                        <option value="1" >是</option>
                                    </select>

                                </td>
                            </tr>
                                
                                                <tr class="info">
                                                    <td colspan="2" style="text-align: center">
                                                        <a href="#"  class="btn btn-info btn-small" onclick="saveModel()"   >确定 </a>
                                                        &nbsp; &nbsp;&nbsp;&nbsp;
                                                        <a href="#"  class="btn btn-danger btn-small bigger-110"  onclick="parent.closeDialog();"  >取消 </a>
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                    </form>
                </div>
            </div>
        </div>
    </div>
    </body>

    <script>
        /**
         *
         */
        <#list newlist as m>
        document.getElementById("id").value  =  '${(m.id)!}';
        document.getElementById("msgtype").value  =  '${(m.msgtype)!}';
        document.getElementById("title").value  =  '${(m.title)!}';
        document.getElementById("url").value  =  '${(m.url)!}';
        document.getElementById("hqurl").value  =  '${(m.hqurl)!}';
        document.getElementById("description").value  =  '${(m.description)!}';
        document.getElementById("picurl").value  =  '${(m.picurl)!}';
        </#list>



    </script>
</@layout>

